/*
 * Copyright (c) 2025 Li Auto Inc. and its affiliates
 * Licensed under the Apache License, Version 2.0(the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ETH_TRCV_GENERAL_TYPES_H
#define ETH_TRCV_GENERAL_TYPES_H

#include "Platform_Types.h"

typedef enum {
	ETHTRCV_MODE_DOWN = 0x00U,
	ETHTRCV_MODE_ACTIVE = 0x01U
} eth_trcv_mode_type; /* ETHTRCV modes */

typedef enum {
	ETHTRCV_LINK_STATE_DOWN = 0x00U,
	ETHTRCV_LINK_STATE_ACTIVE = 0x01U
} eth_trcv_linkstate_type; /* ETHTRCV link states */

typedef enum {
	ETHTRCV_BAUD_RATE_10MBIT = 0x00U,
	ETHTRCV_BAUD_RATE_100MBIT = 0x01U,
	ETHTRCV_BAUD_RATE_1000MBIT = 0x02U
} eth_trcv_baud_rate_type; /* ETHTRCV baud rates */

typedef enum {
	ETHTRCV_DUPLEX_MODE_HALF = 0x00U,
	ETHTRCV_DUPLEX_MODE_FULL = 0x01U
} eth_trcv_duplex_mode_type; /* ETHTRCV duplex modes */

typedef enum {
	ETHTRCV_STATE_UNINIT = 0x00U,
	ETHTRCV_STATE_INIT = 0x01U,
	ETHTRCV_STATE_ACTIVE = 0x02U,
	ETHTRCV_STATE_DOWN = 0x03U
} eth_trcv_state_type; /* ETHTRCV state */

typedef enum {
	ETHTRCV_WAKEUP_NOT_SUPPORTED = 0x00U,
	ETHTRCV_WAKEUP_BY_INTERRUPT = 0x01U,
	ETHTRCV_WAKEUP_BY_POLLING = 0x02U
} eth_trcv_wakeup_type; /* ETHTRCV wakeup types */

typedef enum {
	ETHTRCV_WUM_DISABLE = 0x00U,
	ETHTRCV_WUM_ENABLE = 0x01U,
	ETHTRCV_WUM_CLEAR = 0x02U
} eth_trcv_wakeup_mode_type; /* ETHTRCV wakeup modes */

typedef enum {
	ETHTRCV_WUR_NONE = 0x00U,
	ETHTRCV_WUR_GENERAL = 0x01U,
	ETHTRCV_WUR_BUS = 0x02U,
	ETHTRCV_WUR_INTERNAL = 0x03U,
	ETHTRCV_WUR_RESET = 0x04U,
	ETHTRCV_WUR_POWER_ON = 0x05U,
	ETHTRCV_WUR_PIN = 0x06U,
	ETHTRCV_WUR_SYSERR = 0x07U
} eth_trcv_wakeup_reason_type; /* ETHTRCV wakeup reasons */

/* count of wakeup reasons defined for the transceiver */
#define ETHTRCV_WUR_NUM (0x07U)

#define ETHTRCV_WUR_GENERAL_FLAGS_MASK (0x01U)
#define ETHTRCV_WUR_BUS_FLAGS_MASK (0x02U)
#define ETHTRCV_WUR_INTERNAL_FLAGS_MASK (0x04U)
#define ETHTRCV_WUR_RESET_FLAGS_MASK (0x08U)
#define ETHTRCV_WUR_POWER_ON_FLAGS_MASK (0x10U)
#define ETHTRCV_WUR_PIN_FLAGS_MASK (0x20U)
#define ETHTRCV_WUR_SYSERR_FLAGS_MASK (0x40U)
#define ETHTRCV_WUR_CLEAR_MASK (0x00U)

typedef uint8 eth_trcv_wakeup_reason_flags_type; /* ETHTRCV wakeup reason flags */

typedef enum {
	ETHTRCV_ICU_CHANNEL = 0x01U,
	ETHTRCV_TRCV_REGISTERS = 0x02U,
	ETHTRCV_USER_CODE = 0x03U
} eth_trcv_wakeup_inspection_type;

typedef enum {
	ETHTRCV_MII_MODE = 0x00U,
	ETHTRCV_LIGHT_MII_MODE = 0x01U,
	ETHTRCV_RMII_MODE = 0x02U,
	ETHTRCV_RMII_XTAL_MODE = 0x03U,
	ETHTRCV_GMII_MODE = 0x04U,
	ETHTRCV_RGMII_MODE = 0x05U,
	ETHTRCV_RGMII_XTAL_MODE = 0x06U,
	ETHTRCV_STRAPPING_CONFIG_ONLY = 0x07U,
	ETHTRCV_DONT_CARE = 0xFFU
} eth_trcv_mii_mode_type; /* ETHTRCV MII modes */

typedef enum {
	ETHTRCV_CONN_NEG_AUTO = 0x00U,
	ETHTRCV_CONN_NEG_MASTER = 0x01U,
	ETHTRCV_CONN_NEG_SLAVE = 0x02U,
	ETHTRCV_CONN_NEG_MANUAL = 0x03U
} eth_trcv_conn_neg_mode_type; /* ETHTRCV CONN NEG modes*/

#define ETHTRCV_PHYS_ADDR_LEN_BYTE (0x06U)

typedef enum {
	ETHTRCV_PHYTESTMODE_NONE = 0x00U,
	ETHTRCV_PHYTESTMODE_1 = 0x01U,
	ETHTRCV_PHYTESTMODE_2 = 0x02U,
	ETHTRCV_PHYTESTMODE_3 = 0x03U,
	ETHTRCV_PHYTESTMODE_4 = 0x04U,
	ETHTRCV_PHYTESTMODE_5 = 0x05U
} eth_trcv_phy_test_mode_type; /* ETHTRCV Phy Test Modes */

typedef enum {
	ETHTRCV_PHYLOOPBACK_NONE = 0x00U,
	ETHTRCV_PHYLOOPBACK_INTERNAL = 0x01U,
	ETHTRCV_PHYLOOPBACK_EXTERNAL = 0x02U,
	ETHTRCV_PHYLOOPBACK_REMOTE = 0x03U
} eth_trcv_phy_loopback_mode_type; /* ETHTRCV Phy Loopback Modes */

typedef enum {
	ETHTRCV_PHYTXMODE_NORMAL = 0x00U,
	ETHTRCV_PHYTXMODE_TX_OFF = 0x01U,
	ETHTRCV_PHYTXMODE_SCRAMBLER_OFF = 0x02U
} eth_trcv_phy_tx_mode_type; /* ETHTRCV Phy Tx Modes */

typedef enum {
	ETHTRCV_CABLEDIAG_OK = 0x00U,
	ETHTRCV_CABLEDIAG_ERROR = 0x01U,
	ETHTRCV_CABLEDIAG_SHORT = 0x02U,
	ETHTRCV_CABLEDIAG_OPEN = 0x03U
} eth_trcv_cable_diag_result_type; /* ETHTRCV Cable Diagnostic Status */

typedef uint8 eth_trcv_phys_addr_type[ETHTRCV_PHYS_ADDR_LEN_BYTE];

#endif /* ETH_TRCV_GENERAL_TYPES_H */
